//
//  PBHomeCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2017/11/21.
//  Copyright © 2017年 tmkj. All rights reserved.
//

#import "PBHomeCell.h"
#import "PBHomeTrafficModel.h"

@interface PBHomeCell ()

@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *tipLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (strong, nonatomic) IBOutlet UILabel *ownLabel;

@end

@implementation PBHomeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.tipLabel.layer.borderWidth = 0.5;
    self.tipLabel.layer.borderColor = [UIColor tm_majorFontColor].CGColor;
    self.ownLabel.layer.borderWidth = 0.5;
    self.ownLabel.layer.borderColor = [UIColor tm_majorFontColor].CGColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWithModel:(PBBestHomeModel *)model {
    [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:nil];
    self.nameLabel.text = model.name;
    self.typeLabel.text = model.type;
    if (model.houseTrafficList.count>0) {
        PBHomeTrafficModel *traffic = model.houseTrafficList[0];
        self.addressLabel.text = traffic.traffic;
    }
    self.tipLabel.text = model.entireRent?@"整租":@"合租";
    self.ownLabel.hidden = !model.ownerRent;
    self.priceLabel.text = [NSString stringWithFormat:@"%@元/月",model.rent];
    
}

@end
